//
//  ZWBSquareCell.m
//  Cat
//
//  Created by dllo on 15/11/26.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ZWBSquareCell.h"

@implementation ZWBSquareCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self create];
    }
    return self;
}

- (void)create {
    
    self.backImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_backImageView];
    
    self.frontImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_frontImageView];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_titleLabel];
    
    self.timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_timeLabel];
    
    self.typeImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_typeImageView];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _titleLabel.font = [UIFont systemFontOfSize:15];
    _timeLabel.font = [UIFont systemFontOfSize:12];
    _timeLabel.textColor = [UIColor whiteColor];
    _titleLabel.textColor = [UIColor whiteColor];
    
    
    [_backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.center.equalTo(self.contentView);
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(10, 10, 10, 10));
    }];
    
    _frontImageView.backgroundColor = [UIColor blackColor];
    _frontImageView.alpha = 0.5;
    [_frontImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.backImageView.mas_left).offset(0);
        make.right.equalTo(self.backImageView.mas_right).offset(0);
        make.bottom.equalTo(self.backImageView.mas_bottom).offset(0);
//        make.height.offset((self.contentView.bounds.size.height - 20)/5);
    }];
    

    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.backImageView.mas_left).offset(10);
        make.top.equalTo(self.frontImageView.mas_top).offset(3);
        make.bottom.equalTo(self.timeLabel.mas_top).offset(-3);
        make.height.mas_equalTo((self.contentView.bounds.size.height - 20)/4/ 2);
        make.width.mas_equalTo(self.contentView.frame.size.width *2/3);
        
        
    }];
//
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.frontImageView.mas_left).offset(10);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(3);
        make.bottom.equalTo(self.frontImageView.mas_bottom).offset(-3);
        make.width.mas_equalTo(self.contentView.frame.size.width *2 / 3);
        make.height.mas_equalTo((self.contentView.bounds.size.height - 20)/4/ 2);
//        make.right.equalTo(self.typeImageView.mas_left).offset(-5);
    }];
//
    [_typeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.frontImageView.mas_top).offset(3);
        make.bottom.equalTo(self.frontImageView.mas_bottom).offset(-3);
        make.right.equalTo(self.frontImageView.mas_right).offset(-10);
//        make.left.equalTo(self.titleLabel.mas_right).offset(5);
        
        make.width.mas_equalTo(self.contentView.bounds.size.height / 4);
        
    }];
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
